package cn.imjzm.runcarserve.utils;

import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;

public class Bcrypt {
    private static final BCryptPasswordEncoder encoder = new BCryptPasswordEncoder();

    /**
     * 密码校验
     * @param rawPassword 未加密的密码
     * @return
     */

    public static String encryptPassword(String rawPassword)
    {
        return encoder.encode(rawPassword);
    }

    /**
     * 密码校验
     * @param rawPassword 未加密的密码
     * @param encodedPassword 加密后的密码
     * @return
     */

    public static boolean matches(CharSequence rawPassword, String encodedPassword)
    {
        return encoder.matches(rawPassword, encodedPassword);
    }
}
